﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Sharp.Domain.Model;
using Sharp.Domain.PlatformBoundedContext.UserModule.Aggregates;


namespace Sharp.Domain.PlatformBoundedContext.MessageModule.Aggregates
{
    public partial class Message : AggregateRoot, IStandardState
    {
        public Message()
        {
            PublishTime = DateTime.Now;
        }

        /// <summary>
        /// 内容
        /// </summary>
        [MaxLength(255)]
        public string Content { get; set; }
        /// <summary>
        /// 发布时间
        /// </summary>
        public DateTime PublishTime { get; set; }
        /// <summary>
        /// 发件人id
        /// </summary>
        public Guid? SenderId { get; set; }
        /// <summary>
        /// 收件人Id
        /// </summary>
        public Guid? ReceiverId { get; set; }
        /// <summary>
        /// 发件人
        /// </summary>
        [ForeignKey("SenderId")]
        public User Sender { get; set; }
        /// <summary>
        /// 收件人
        /// </summary>
        [ForeignKey("ReceiverId")]
        public virtual User Recipient { get; set; }
        /// <summary>
        /// 是否已读
        /// </summary>
        public bool IsReaded { get; set; }
        /// <summary>
        /// 阅读时间
        /// </summary>
        public DateTime? ReadedTime { get; set; }
        public EntityStateOperate EntityState { get; set; }
    }
}
